from matplotlib import pyplot as plt
import numpy as np
from scipy.interpolate import make_interp_spline

while True:
    try:
        a0=input("请输入特殊点的x轴，用空格分隔(0 3 27 29 35 37)(x轴坐标必须从小到大排列且不能重复)： ")
        b0=input("请输入特殊点的y轴，用空格分隔(0 2 26 26 2 0)： ")
        n = input("输入图像周期的个数的(3)：")
        n=int(n)
        a = [int(n) for n in a0.split()]
        b = [int(n) for n in b0.split()]
        n1=len(a)
        c=np.diff(a)
        d=np.diff(b)
        for ni in range(n):    
            x=a
            for ci in c:
                a=np.append(a,a[-1]+ci)
            y=b
            for di in d:
                b=np.append(b,b[-1]+di)
        print(x)
        print(y)
        x_smooths=[]
        for ni in range(n):
            x_smooth = np.linspace(x[0+(n1-1)*ni],x[(n1-1)+(n1-1)*ni],3072) #300 represents number of points to make between x.min and x.max
            x_smooths=np.append(x_smooths,x_smooth)
        y_smooth = make_interp_spline(x, y)(x_smooths)
        plt.plot(x_smooths,y_smooth,'o')
        plt.plot(x,y,'*')
        plt.show()
    except:
        print('画不出来')
        continue